package com.xuecheng.order.job;

import com.xuecheng.order.service.OrdersService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class OrderJob {

    @Autowired
    private OrdersService ordersService;

    // 每间隔30秒，查询未支付订单，清理
     //@Scheduled(cron = "0/30 * * * * ?") // TODO 进行测试阶段在打开此注释
    public void clearOrderMethod() {
        log.info("清理超时订单...");
        ordersService.clearOrder();
    }
}
